From 8a8798bdbc92825e9a15813cf68a0bccb98e0ec7 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 5 Mar 2004 07:46:06 +0000 Subject: [PATCH] Document the fact that there might not be a volume for all paths. 2004-03-05 Alexander Larsson * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): Document the fact that there might not be a volume for all paths. * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder): Don't assume there is a volume for all paths. --- ChangeLog | 9 +++++++++ ChangeLog.pre-2-10 | 9 +++++++++ ChangeLog.pre-2-4 | 9 +++++++++ ChangeLog.pre-2-6 | 9 +++++++++ ChangeLog.pre-2-8 | 9 +++++++++ gtk/gtkfilechooserdefault.c | 13 +++++++++---- gtk/gtkfilesystem.c | 5 ++++- 7 files changed, 58 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index c34388f68e..51db8459f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-03-05 Alexander Larsson + + * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): + Document the fact that there might not be a volume for all + paths. + + * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder): + Don't assume there is a volume for all paths. + Fri Mar 5 01:45:04 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c34388f68e..51db8459f6 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2004-03-05 Alexander Larsson + + * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): + Document the fact that there might not be a volume for all + paths. + + * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder): + Don't assume there is a volume for all paths. + Fri Mar 5 01:45:04 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c34388f68e..51db8459f6 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2004-03-05 Alexander Larsson + + * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): + Document the fact that there might not be a volume for all + paths. + + * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder): + Don't assume there is a volume for all paths. + Fri Mar 5 01:45:04 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c34388f68e..51db8459f6 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2004-03-05 Alexander Larsson + + * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): + Document the fact that there might not be a volume for all + paths. + + * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder): + Don't assume there is a volume for all paths. + Fri Mar 5 01:45:04 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c34388f68e..51db8459f6 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2004-03-05 Alexander Larsson + + * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path): + Document the fact that there might not be a volume for all + paths. + + * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder): + Don't assume there is a volume for all paths. + Fri Mar 5 01:45:04 2004 Jonathan Blandford * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 1692c2d093..8369716d34 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -1088,20 +1088,25 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl) pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER); volume = gtk_file_system_get_volume_for_path (impl->file_system, impl->current_folder); - base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); - - if (strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0) + if (volume) + base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume); + else + base_path = NULL; + + if (base_path && + strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0) { success = shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL); impl->shortcuts_current_folder_is_volume = TRUE; } else { - gtk_file_system_volume_free (impl->file_system, volume); success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL); impl->shortcuts_current_folder_is_volume = FALSE; } + if (volume) + gtk_file_system_volume_free (impl->file_system, volume); gtk_file_path_free (base_path); if (!success) diff --git a/gtk/gtkfilesystem.c b/gtk/gtkfilesystem.c index 156d352f13..2c018a9d43 100644 --- a/gtk/gtkfilesystem.c +++ b/gtk/gtkfilesystem.c @@ -340,9 +340,12 @@ gtk_file_system_create_folder(GtkFileSystem *file_system, * @path: a #GtkFilePath * * Queries the file system volume that corresponds to a specific path. + * There might not be a volume for all paths (consinder for instance remote + * shared), so this can return NULL. * * Return value: the #GtkFileSystemVolume that corresponds to the specified - * @path. You should free this value with gtk_file_system_volume_free(). + * @path, or NULL if there is no such volume. You should free this value with + * gtk_file_system_volume_free(). **/ GtkFileSystemVolume * gtk_file_system_get_volume_for_path (GtkFileSystem *file_system, -- 2.30.2